<!DOCTYPE html>
<html lang="en" theme="dark">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Playlist download</title>
    <link rel="stylesheet" href="../assets/css/index.css">
    <script src="../src/playlist.js" defer></script>
    <script src="../src/common.js" defer></script>
    <!-- Translating -->
    <script>window.i18n = new (require('../translations/i18n'));</script>
    <style>
        #playlistName {
            padding: 30px;
        }

        #pasteLink {
            margin-top: 15px;
            font-weight: bold;
        }

        #openDownloads {
            display: none;
            position: relative;
            bottom: 8px;
        }

        #audioBox {
            display: none;
        }

        #advancedMenu {
            display: none;
        }
    </style>
</head>

<body>
    <!-- Popup message -->
    <span id="popupText">Text copied</span>

    <!-- Menu icon -->
    <img src="../assets/images/menu.png" alt="menu" id="menuIcon">

    <!-- Menu -->
    <div id="menu">
        <a id="homeWin" class="menuItem">Homepage</a>
        <a id="compressorWin" class="menuItem">Compressor</a>
        <a id="preferenceWin" class="menuItem">Preferences</a>
        <a id="aboutWin" class="menuItem">About</a>
        <span id="themeTxt" class="menuItem">Theme:</span>
        <select name="themeToggle" id="themeToggle">
            <option id="lightTxt" value="light">Light</option>
            <option id="darkTxt" value="dark">Dark</option>
            <option id="frappeTxt" value="frappe">Frappé</option>
            <option id="onedarkTxt" value="onedark">One dark</option>
            <option id="matrixTxt" value="matrix">Matrix</option>
            <option id="githubTxt" value="github">Github</option>
            <option id="latteTxt" value="latte">Latte</option>
            <option id="solarizedDarkTxt" value="solarized-dark">Solarized Dark</option>
        </select>
    </div>

    <button class="submitBtn" id="pasteLink">Click to paste playlist link from clipboard [Ctrl + V]</button>

    <div id="options">
        <img src="../assets/images/close.png" alt="close" id="closeHidden">
        <div id="btnContainer">
            <button class="toggleBtn" id="videoToggle">Video</button>
            <button class="toggleBtn" id="audioToggle">Audio</button>
        </div>
        <br>
        <strong id="linkTitle">Link:</strong>
        <span id="link"></span>
        <br><br>
        <div id="videoBox">
            <label id="videoFormat">Select Video Format </label>
            <select id="select" class="select">
                <option value="best" id="bestVideoOption">Best</option>
                <option value="worst" id="worstVideoOption">Worst</option>
                <option value="useConfig" id="useConfigTxt">Use config file</option>
                <option value="144">144p</option>
                <option value="240">240p</option>
                <option value="360">360p</option>
                <option value="480">480p</option>
                <option value="720">720p (HD)</option>
                <option value="1080">1080p (FHD)</option>
                <option value="1440">1440p</option>
                <option value="2160">2160p (4k)</option>
            </select>
            <br>
            <div id="typeSelectBox">
                <label id="videoQualityTxt">Select video quality</label>
                <select id="videoTypeSelect" class="select">
                    <option value="auto" id="autoTxt">Auto</option>
                    <option value="mp4">Mp4</option>
                    <option value="webm">WebM</option>
                </select>
            </div>
            <br>
            <button class="submitBtn" id="download">Download</button>
            <br><br>
        </div>

        <div id="audioBox">

            <label id="audioFormat">Select Audio format </label>
            <select id="audioSelect" class="select">
                <option value="mp3">Mp3</option>
                <option value="m4a">M4a</option>
                <option value="opus">Opus</option>
                <option value="wav">Wav</option>
                <option value="alac">Alac</option>
                <option value="flac">Flac</option>
                <option value="vorbis">Vorbis (ogg)</option>
            </select>
            <br>

            <label class="audioQualitySelect" id="audioQualitySelectTxt">Select Quality</label>
            <select id="audioQualitySelect" class="select">
                <option id="audioQualityAuto" value="auto">Auto</option>
                <option id="audioQualityNormal" value="5">Normal</option>
                <option id="audioQualityBest" value="0">Best</option>
                <option id="audioQualityGood" value="2">Good</option>
                <option id="audioQualityBad" value="8">Bad</option>
                <option id="audioQualityWorst" value="10">Worst</option>
            </select>
            <br><br>

            <button class="submitBtn" id="audioDownload">Download</button>
            <br><br>

        </div>

        <br>
        <button id="advancedToggle" class="blueBtn">More options</button>
        <br>

        <!-- Hidden -->
        <div id="advancedMenu">
            <div class="advancedItem">
                <span id="rangeTxt">Playlist range</span>
                <input type="number" id="playlistIndex" class="input" placeholder="Start">:
                <input type="number" id="playlistEnd" class="input" placeholder="End">
                <br><br>
            </div>

            <div class="advancedItem">
                <div><span id="clText">Current download location - </span><span id="path"></span></div>
                <br>
                <button id="selectLocation" class="submitBtn">Select Download Location</button>
            </div>

            <div class="advancedItem">
                <p id="subHeader">Subtitles</p>
                <span id="subTxt">Download subtitles if available</span>
                <input id="subChecked" class="cb" type="checkbox">
            </div>
            <br>

            <button class="submitBtn" id="downloadThumbnails">Download thumbnails</button>
            <button class="submitBtn" id="saveLinks">Save video links</button>
        </div>

        <p id="incorrectMsgPlaylist"></p>
        <!-- Error button -->
        <button class="advancedToggle" id="errorBtn" onclick="toggleErrorDetails()">Error Details ▼</button>
        <div id="errorDetails" onclick="copyErrorToClipboard()"></div>

    </div>

    <h2 id="playlistName"></h2>
    <button class="submitBtn" id="openDownloads">Open download folder</button>
    <div id="list">
    </div>

    <!-- <button class="advancedToggle" id="finishBtn">Finish downloading</button> -->
    <div id="goToTop"></div>
</body>

</html>